try:
    from plc_client.layer1.mdsTcp_client import MdsClient
    from plc_client.layer1.s7_client import S7Client
    from plc_client.layer1.sim_client import SimClient
    from plc_client.layer1.etherNetIpHsl_client import EthIpHslClient
except:
    from .mdsTcp_client import MdsClient
    # from .s7_client import S7Client
    from .sim_client import SimClient
    from .etherNetIpHsl_client import EthIpHslClient

class Lay1PLCFactory: #
    @staticmethod
    def create(class_type, ip='127.0.0.1', port=1102):
        if class_type == "modbus_tcp":
            return MdsClient(ip=ip, port=port)
        elif class_type == "s7_tcp":
            return S7Client(ip=ip, port=port)
        elif class_type == "eth_ip_cip":
            return EthIpHslClient(ip=ip, port=port)
        elif class_type == "sim":
            return SimClient(ip=ip, port=port)
        else:
            raise ValueError("Invalid transport type")